<template>
  <div class="header">
    <div class="header__top">
      <div class="header__avatar">
        <img :src="seller.avatar" alt="">
      </div>
      <div class="header__content">
        <p class="content__name">
          <span class="name__brand"></span>
          <span class="name__title">{{seller.name}}</span>
        </p>
        <p class="content__description">
          {{seller.description}}&nbsp;/&nbsp;{{seller.deliveryTime}}分钟送达
        </p>
        <p v-if='seller.supports' class="content__activity">
          <span class="activity__icon"></span>
          <span class="activity__text">{{seller.supports[0].description}}</span>
        </p>
      </div>
      <div class="header__link" v-if='seller.supports'>
        <a href="#">
          <span>{{seller.supports.length}}个</span>
          <i class="iconfont icon-jinru"></i>
        </a>
      </div>
    </div>
    <div class="header__notice" @click="showFloat">
      <span class="notice__icon"></span>
      <p>{{seller.bulletin}}</p>
      <span class="iconfont icon-jinru"></span>
    </div>
    <div class="header__background">
      <img v-bind:src="seller.avatar" alt="">
    </div>
    <div v-if="isShow" class="mask">
      <div class="mask__content">
        <h1 class="content__title">{{seller.name}}</h1>
        <div class="content__star">
          <Star :score="seller.score"></Star>
        </div>
        <div class="content__saleMsg" v-if="seller.supports">
          <h2>
            <span class="saleMsg__bor"></span>
            <span class="sub__title">优惠信息</span>
            <span class="saleMsg__bor"></span></h2>
          <p><span class="saleMsg__decrease"></span>{{seller.supports[0].description}}</p>
          <p><span class="saleMsg__discount"></span>{{seller.supports[1].description}}</p>
          <p><span class="saleMsg__discount"></span>{{seller.supports[2].description}}</p>
          <p><span class="saleMsg__guarantee"></span>{{seller.supports[3].description}}</p>
          <p><span class="saleMsg__guarantee"></span>{{seller.supports[4].description}}</p>
        </div>
        <div class="content__notice">
          <h2>
            <span class="saleMsg__bor"></span>
            <span class="sub__title">商家公告</span>
            <span class="saleMsg__bor"></span></h2>
          <p class="notice__intrdct">{{seller.bulletin}}</p>
        </div>
      </div>
      <div class="content__close">
        <p @click="isShow = !isShow">
          <span class="iconfont icon-close"></span>
        </p>
      </div>
    </div>
  </div>
</template>

<script>
import Star from '@/pages/common/Star'
export default {
  name: 'SellerHeader',
  props: {
    seller: {
      type: Object
    }
  },
  data () {
    return { isShow: false }
  },
  methods: {
    showFloat: function () {
      this.isShow = !this.isShow
    }
  },
  components: { Star }
}
</script>

<style lang="scss" scoped>
  @import '~@/assets/style/common';
  .header {
    position: relative;
    color: #fff;
    background: rgba(7, 17, 27, .5)
  }
  .header__top {
    position: relative;
    padding: 48px 14px 36px 48px;
    font-size: 0;

    .header__avatar,
    .header__content {
      display: inline-block;
      vertical-align: bottom;
      font-size: 14px;
    }
    .header__avatar {
      margin-right: 16px;
      & > img {
        width: 128px;
        height: 128px;
      }
    }
    .header__content {
      font-size: 28px;
      & > .content__name {
        line-height: 36px;
        margin-bottom: 8px;
        .name__brand {
          display: inline-block;
          vertical-align: top;
          height: 36px;
          width: 62px;
          @include bg-image('../img/brand');
          background-repeat: no-repeat;
          background-position: center;
          background-size: cover;
        }
        .name__title {
          font-size: 32px;
          font-weight: 700;
        }
      }
      & > .content__description {
        font-size: 24px;
        line-height: 24px;
        margin-bottom: 8px;
      }
      & > .content__activity {
        line-height: 24px;
        .activity__icon {
          display: inline-block;
          height: 24px;
          width: 24px;
          @include bg-image('../img/decrease_2');
          background-repeat: no-repeat;
          background-position: center;
          vertical-align: middle;
          background-size: cover;
        }
        .activity__text {
          font-size: 20px;
        }
      }
    }
    .header__link {
      position: absolute;
      height: 48px;
      width: 88px;
      right: 24px;
      bottom: 36px;
      background: rgba(0, 0, 0, .2);
      border-radius: 14px;
      line-height: 48px;
      text-align: center;
      & > a {
        display: inline-block;
        font-size: 20px;
        color: rgb(255, 255, 255);
        & > i {
          vertical-align: -2px;
        }
      }
    }
  }
  .header__notice {
    display: flex;
    align-items: center;
    height: 56px;
    line-height: 56px;
    padding: 0 24px;
    background: rgba(7, 17, 27, .2);
    font-size: 20px;

    .notice__icon {
      flex-shrink: 0;
      height: 25px;
      width: 44px;
      @include bg-image('../img/bulletin');
      background-position: center;
      background-size: cover;
      vertical-align: bottom;
    }
    & > p {
      @include omit;
      padding: 0 8px;
      flex-shrink: 1;
    }
  }
  .header__background {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    z-index: -1;
    filter: blur(10px);
    img {
      width: 100%;
      height: 100%;
    }
  }
  .mask {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    overflow: auto;
    background: rgba(7, 17, 27, .8);
    z-index: 999999;
    &::-webkit-scrollbar {
      display: none
    }
    .mask__content {
      width: 100%;
      min-height: 100%;
      padding: 128px 72px;
    }
    .content__close {
      position: relative;
      margin-top: -128px;
      text-align: center;
      .icon-close {
        display: inline-block;
        color: rgba(255, 255, 255, .5);
        font-size: 64px;
      }
    }
  }
  .mask__content {
    h1 {
      font-size: 32px;
      line-height: 32px;
      margin-bottom: 32px;
    }
    h1,h2 {
      font-weight: 700;
      text-align: center;
      .saleMsg__bor {
        flex: 1;
        display: inline-block;
        height: 12px;
        border-bottom: 3px solid rgba(255, 255, 255, .2);
        line-height: 28px;
        font-size: 24px;
      }
    }
    .sub__title {
      padding: 0 24px;
    }
    .content__title {
      margin-bottom: 32px;
      font-size: 32px;
      line-height: 32px;
    }
    .content__star {
      margin-bottom: 56px;
      text-align: center;
    }
    .content__notice,
    .content__saleMsg {
      margin-bottom: 48px;
      h2 {
        display: flex;
        font-size: 28px;
        line-height: 28px;
        margin-bottom: 48px;
      }
      p {
        padding-left: 24px;
        margin-bottom: 24px;
        font-size: 24px;
        line-height: 24px;
      }
    }
    .content__saleMsg {
      .saleMsg__decrease,
      .saleMsg__discount,
      .saleMsg__guarantee {
        display: inline-block;
        vertical-align: middle;
        margin-right: 12px;
        height: 32px;
        width: 32px;
        border-radius: 4px;
        background-position: center;
        background-size: cover;
      }
      .saleMsg__decrease {
        @include bg-image('../img/decrease_2');
      }
      .saleMsg__discount {
        @include bg-image('../img/discount_2');
      }
      .saleMsg__guarantee {
        @include bg-image('../img/guarantee_2');
      }
    }
    .content__notice {
      .notice__intrdct {
        font-size: 24px;
        line-height: 48px;
      }
    }
  }
</style>
